package linuxbox.calendar.taglib;

import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;

import linuxbox.util.StringUtil;
/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2003</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class CalendarTimeZone
    extends TagSupport
{
  protected String defaultTZ;

  public int doStartTag() throws JspException
  {
    try
    {
      JspWriter out = pageContext.getOut();

      for (int i = 0; i < StringUtil.TimeZone_list[0].length; i++)
      {
        out.print("<option ");
        if (defaultTZ.compareToIgnoreCase(StringUtil.TimeZone_list[0][i]) == 0)
          out.print(" selected ");
        out.print("value=\"");
        out.print(StringUtil.TimeZone_list[0][i]);
        out.print("\">");
        out.print(StringUtil.TimeZone_list[1][i]);
        out.print("</option>");
      }
    }
    catch (Exception e)
    {
      e.printStackTrace();
      throw new JspException(e.getMessage());
    }

    return SKIP_BODY;
  }

  public void setdefaultTZ(String s)
  {
    defaultTZ = s;
  }
}
